package com.alog.common.code;

public class LockQueueTest {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                while(true){
                    LockSyncQueue.getInstance().poll();
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }, "consumer" + i).start();
            new Thread(() -> {
                while(true){
                    LockSyncQueue.getInstance().add();
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }, "productor" + i).start();
        }
    }
}
